package com.yunhan.scc.oms.web.service.impl.excel;

import java.lang.reflect.Field;
/**
 * 实体测试类
* @ClassName: Studer 
* @author YangTao
* @date 2017-4-21 上午10:50:45
 */
public class Studer implements ExcelExportMustImpMethodBean{
	
	//姓名
	@ExcelBeanMethodUtil(excelHeadName="姓名",excelHeadMthod="getName")
	public String name;
	//班级
	@ExcelBeanMethodUtil(excelHeadName="班级",excelHeadMthod="getBanji")
	public String banji;
	//笔试成绩
	@ExcelBeanMethodUtil(excelHeadName="笔试成绩",excelHeadMthod="getBishicj")
	public int bishicj;
	//机考成绩
	@ExcelBeanMethodUtil(excelHeadName="机试成绩",excelHeadMthod="getJishicj")
	public int jishicj;
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getBanji() {
		return banji;
	}
	public void setBanji(String banji) {
		this.banji = banji;
	}
	public int getBishicj() {
		return bishicj;
	}
	public void setBishicj(int bishicj) {
		this.bishicj = bishicj;
	}
	public int getJishicj() {
		return jishicj;
	}
	public void setJishicj(int jishicj) {
		this.jishicj = jishicj;
	}
	
//	public static void main(String[] args) {
//		Studer studer = new Studer();
//		studer.setName("name");
//		studer.setBanji("四年级一班");
//		studer.setBishicj((int)(Math.random() * 100 + 1));
//		studer.setJishicj((int)(Math.random() * 100 + 1));
//		Field[] fields = studer.getClass().getDeclaredFields();
//		
//		for(Field f : fields){
//			ExcelBeanMethodUtil excelBeanMethodUtil = f.getAnnotation(ExcelBeanMethodUtil.class);
//			//System.out.println(excelBeanMethodUtil.excelHeadMthod() + excelBeanMethodUtil.excelHeadName());
//			
//		}
//		
//		
////		Method[] methods = studer.getClass().getMethods();
////		for(Method m : methods){
////			System.out.println(m.getName());
////		}
//	}
	
	public String getMethodName(ExcelExportMustImpMethodBean excelExportMustImpMethodBean,String headName){
		Field[] fields = excelExportMustImpMethodBean.getClass().getDeclaredFields();
		for(Field f : fields){
			ExcelBeanMethodUtil excelBeanMethodUtil = f.getAnnotation(ExcelBeanMethodUtil.class);
			if(excelBeanMethodUtil == null){
				continue;
			}
			if(excelBeanMethodUtil.excelHeadName().equals(headName)){
				return excelBeanMethodUtil.excelHeadMthod();
			}else{
				continue;
			}
		}
		return null;
		
	}
	
}
